package com.heima.feign.wemedia.wm;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.heima.model.admin.dtos.NewsAuthRequestDTO;
import com.heima.model.admin.dtos.NewsAuthResponseDTO;
import com.heima.model.media.dtos.WmUserSaveDTO;
import com.heima.model.user.dtos.AuthDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * @author Fuqiang
 * @since :2023-03-25
 */
@FeignClient(value = "leadnews-wemedia",contextId = "news")
public interface WmFeignClients {
    /**
     * 保存自媒体用户
     *
     * @param dto
     * @return 自媒体用户id
     */
    @PostMapping("/api/v1/wmuser/save")
    Integer save(@Validated @RequestBody WmUserSaveDTO dto);

    /**
     * 分页查询自媒体文章人工审核信息
     *
     * @param dto
     * @return
     */
    @PostMapping("/api/v1/news/feign/page")
    Page<NewsAuthResponseDTO> findByPageWithFeign(@RequestBody NewsAuthRequestDTO dto);

    /**
     * 根据自媒体文章id查询自媒体文章人工审核信息
     *
     * @param wmNewsId
     * @return
     */
    @GetMapping("/api/v1/news/feign/one/{id}")
    NewsAuthResponseDTO findNewsAuthResponseDTOByWmNewsId(@PathVariable("id") Integer wmNewsId);

    /**
     * 人工审核失败
     *
     * @param dto
     */
    @PostMapping("/api/v1/news/feign/auth_fail")
    void authFail(AuthDTO dto);


    /**
     * 人工审核成功 feign调用
     *
     * @param dto
     */
    @PostMapping("/api/v1/news/feign/auth_pass")
    void authPass(@RequestBody AuthDTO dto);
}
